#!/usr/bin/perl

chdir '..';
use lib '../mods';
use db_config;
use ExploitFarm_SQL;


sub get_conf_teams
{
    my $teams_file='db/teams.txt';
    my $vulnerable_box_suffix='3';

    open F,$teams_file or die "Can`t open team file '$teams_file' : $!\n";
    my %ret;
    while (<F>)
    {
	next if (/^#/);
	chomp;
	/^(.+?)\t+(.+)$/;
	$t=$1;
	$ip=$2;
	next if ($t =~ /^$team$/i);
	$ip.=$vulnerable_box_suffix;
	$ret{$t}=$ip;
    }
    close F;
    return \%ret;
}

$db=new ExploitFarm_SQL($db_host,$db_port,$db_name,$db_login,$db_pass);
$db->connect();
$db->set_teams(get_conf_teams());
